package com.gxa.autoparts.portal.controller;

import com.gxa.autoparts.core.common.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * @author ：looker
 * @date ：Created in 2022/1/8 14:27
 * VIN码查询相关接口
 * 假数据
 */
@RestController
@RequestMapping("/vin")
@Api(tags = "vin码查询相关业务控制器")
public class VINController {

    @PostMapping("/getInfo")
    @ApiOperation("获取VIN信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "VIN",value = "VIN",required = true,dataType = "string",paramType = "query")
    })
    public Map getVinInfo(String VIN){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setMsg(VIN+"的信息");
        Map<String, String> map = new HashMap<>();
        map.put("vin",VIN);
        map.put("factory","一汽大众");
        map.put("carClass","轿车");
        map.put("carStyle","速藤");
        map.put("year","2021");
        map.put("saleName","1.6手自一体 时尚版");
        map.put("carLevel","紧凑型车");
        map.put("carBodyStyle","三厢");
        map.put("driverType","BWH");
        map.put("driverNum","4");
        map.put("displacement","1.6");
        map.put("power","74");
        map.put("TransmissionType","手自一体变速器(AMT)");
        map.put("gear","6");
        map.put("positionNum","5");
        map.put("doorNum","四门");
        jsonResult.setData(map);
        return jsonResult.getDataMap();
    }

    @PostMapping("/getVINHistory")
    @ApiOperation("获取VIN搜索历史")
    public Map getVINHistory(){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        ArrayList<Object> objects = new ArrayList<>();
        objects.add("nvsdkn2621623vsdv");
        objects.add("gdvvd156vsvbsfb16");
        objects.add("mkmf1vsfvs2vs12vs");
        jsonResult.setData(objects);
        return jsonResult.getDataMap();
    }

    @PostMapping("/delVINHistory")
    @ApiOperation("删除VIN搜索历史")
    public Map delVINHistory(){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setMsg("删除成功！");
        return jsonResult.getDataMap();
    }
}
